<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE AllowAmbiguousTypes
           , DataKinds
           , FlexibleInstances
           , KindSignatures
           , MultiParamTypeClasses
           , ScopedTypeVariables
           , TypeApplications
  #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Module      :  GHC.OverloadedLabels</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Copyright   :  (c) Adam Gundry 2015-2016</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Portability :  non-portable (GHC extensions)</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- This module defines the 'IsLabel' class used by the</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- @OverloadedLabels@ extension.  See the</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- &lt;https://gitlab.haskell.org/ghc/ghc/wikis/records/overloaded-record-fields/overloaded-labels wiki page&gt;</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- for more details.</span><span>
</span><span id="line-24"></span><span class="hs-comment">--</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- When @OverloadedLabels@ is enabled, if GHC sees an occurrence of</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- the overloaded label syntax @#foo@, it is replaced with</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- &gt; fromLabel @&quot;foo&quot; :: alpha</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- plus a wanted constraint @IsLabel &quot;foo&quot; alpha@.</span><span>
</span><span id="line-31"></span><span class="hs-comment">--</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- Note that if @RebindableSyntax@ is enabled, the desugaring of</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- overloaded label syntax will make use of whatever @fromLabel@ is in</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- scope.</span><span>
</span><span id="line-35"></span><span class="hs-comment">--</span><span>
</span><span id="line-36"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-comment">-- Note [Overloaded labels]</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- An overloaded label is represented by the 'HsOverLabel' constructor</span><span>
</span><span id="line-41"></span><span class="hs-comment">-- of 'HsExpr', which stores the 'FastString' text of the label and an</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- optional id for the 'fromLabel' function to use (if</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- RebindableSyntax is enabled) .  The type-checker transforms it into</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- a call to 'fromLabel'.  See Note [Type-checking overloaded labels]</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- in GHC.Tc.Gen.Expr for more details in how type-checking works.</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.OverloadedLabels</span><span>
</span><span id="line-48"></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.OverloadedLabels.html#IsLabel"><span class="hs-identifier">IsLabel</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span>       </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Symbol"><span class="hs-identifier">Symbol</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span class="hs-keyword">class</span><span> </span><span id="IsLabel"><span class="annot"><a href="GHC.OverloadedLabels.html#IsLabel"><span class="hs-identifier hs-var">IsLabel</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679565269"><span class="annot"><a href="#local-6989586621679565269"><span class="hs-identifier hs-type">x</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Symbol"><span class="hs-identifier hs-type">Symbol</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679565268"><span class="annot"><a href="#local-6989586621679565268"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-54"></span><span>  </span><span id="fromLabel"><span class="annot"><a href="GHC.OverloadedLabels.html#fromLabel"><span class="hs-identifier hs-type">fromLabel</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679565268"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-55"></span></pre></body></html>